<?php
require_once('../phplib/include.inc.php');

class UserAdmin extends PageBase{
	public function Ini(){
		PageBase::RequireLogin();
		Util::ValidateRight(1);
		$this->GetProduct();
		$this->GetRights();
		$this->GetUsers();
	}
	public function GetProduct(){
		/* @var $db DbMySQL */
		$db = getDb();
		$db->connect();
		$products = $db->fetch("SELECT * FROM product_t");
		$this->assign('products',$products);
	}
	private function GetRights(){
		/* @var $db DbMySQL */
		$db = getDb();
		$db->connect();
		$rids = $db->fetch('SELECT * FROM right_t');
		$rids = json_encode($rids);
		$this->assign('rids',$rids);
	}
	private function GetUsers(){
		/* @var $db DbMySQL */
		$db = getDb();
		$db->connect();
		$users = $db->fetch('SELECT * FROM user_t');
		$this->assign('users',$users);
	}
}
$useradmin = new UserAdmin("file:".dirname(__FILE__)."/../home/useradmin.tpl.html");
$useradmin->display();
?>